#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
Introduction to Programming in Java - An Interdisciplinary Approach

All book programs ported to Python by
Scott C. King (revisionx at {gee}ma1l <dot> c0m).

All program examples pass Pylint with a perfect 10.00 score.
Pylint:  http://www.pylint.org/


Exercise 1.3.13 - Fibonacci sequence

Syntax:
python fibonacci 16


Notes:
int(sys.argv[1]) == Integer.parseInt(args[0])

sys is a required import here in order to use command line arguments.
https://docs.python.org/2/tutorial/stdlib.html

'''

import sys


def main():
    ''' Print values in Fibonacci sequence up to limit '''

    limit = int(sys.argv[1])
    fibonacci = 0
    next_val = 1
    counter = 0
    while counter < limit:
        print fibonacci, next_val
        fibonacci += next_val
        next_val = fibonacci - next_val
        counter += 1


if __name__ == '__main__':
    main()
